package com.hfy.pcberpbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hfy.pcberpbackend.entity.Employee;
import com.hfy.pcberpbackend.dto.EmployeeQueryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 员工Mapper接口
 */
@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {
    
    /**
     * 分页查询员工列表
     */
    IPage<Employee> selectEmployeePage(Page<Employee> page, @Param("query") EmployeeQueryDTO query);
    
    /**
     * 检查员工代码是否存在
     */
    int countByEmployeeCode(@Param("employeeCode") String employeeCode, @Param("excludeId") Long excludeId);
    
    /**
     * 获取业务经理选项
     */
    @Select("SELECT id as `value`, employee_name as label FROM employees WHERE role = 'manager' AND status = 'active' AND deleted = 0 ORDER BY employee_name")
    List<Map<String, Object>> selectManagerOptions();
} 